# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'libjpeg-turbo'
    version = '1.5.1'
    licenses = [License.BSD_like]
    stype = SourceType.TARBALL
    configure_tpl = "%(config-sh)s --prefix=%(prefix)s "\
                    "--libdir=%(libdir)s"
    configure_options = " --with-jpeg8"
    autoreconf = True
    url = 'http://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz'
    patches = ['libjpeg-turbo/0001-Include-limits.h-for-SIZE_MAX.patch']

    files_libs = ['libjpeg','libturbojpeg']
    files_devel = ['include/jpeglib.h', 'include/jerror.h', 'include/jconfig.h',
            'include/jmorecfg.h','include/turbojpeg.h']

    def prepare(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            # avoid using xcode's nasm (doesn't support nasm-like arguments)
            # instead use cerbero's yasm
            self.new_env['NASM'] = 'yasm'
